package com.armed.ejb.entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Class Instituciones
 *
 *
 * @author init() software
 * @version 08/02/2008 
 */
@Entity
@Table(name = "INSTITUCIONES")
@NamedQueries({@NamedQuery(name = "Instituciones.findByRazonSocial", query = "SELECT i FROM Instituciones i WHERE i.razonSocial = :razonSocial")})
public class Instituciones implements Serializable 
{
    private static final long serialVersionUID = 1L;
    @Id @GeneratedValue(strategy=GenerationType.AUTO)
    @Column(name = "ID", nullable = false)
    private String id;
    @Column(name = "RAZON_SOCIAL", nullable = false, unique = true)
    private String razonSocial;
    @OneToMany(cascade=CascadeType.ALL)
    private Collection<Telefonos> telefonosCollection;
    @OneToMany(cascade=CascadeType.ALL)
    private Collection<Direcciones> direccionesCollection;
    /** Constructor of Instituciones */
    public Instituciones()
    {
    }

    public Instituciones(String id)
    {
        this.id = id;
    }
    
    public Object getId()
    {
        return id;
    }

    public String getRazonSocial()
    {
        return razonSocial;
    }

    public void setRazonSocial(String razonSocial)
    {
        this.razonSocial = razonSocial;
    }

    public Collection<Telefonos> getTelefonosCollection()
    {
        return telefonosCollection;
    }

    public void setTelefonosCollection(Collection<Telefonos> telefonosCollection)
    {
        this.telefonosCollection = telefonosCollection;
    }

    public Collection<Direcciones> getDireccionesCollection()
    {
        return direccionesCollection;
    }

    public void setDireccionesCollection(Collection<Direcciones> direccionesCollection)
    {
        this.direccionesCollection = direccionesCollection;
    }

    @Override
    public int hashCode()
    {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object)
    {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Instituciones))
        {
            return false;
        }
        Instituciones other = (Instituciones) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)))
        {
            return false;
        }
        return true;
    }

    @Override
    public String toString()
    {
        return "com.armed.ejb.entities.Instituciones[id=" + id + "]";
    }

    public void setId(String id)
    {
        this.id = id;
    }
}
